﻿using B.S.Data.MES.API.Applications.Management.SteamApplication.Command.OrcanCommand;
using B.S.Domain.Accounts;
using B.S.Infratrctrue;
using B.S.Requst;
using MediatR;

namespace B.S.Data.MES.API.Applications.Management.SteamApplication.CommandHandler.OrcanCommandHandler
{
    public class OrcanUpdateCommandHandler : IRequestHandler<OrcanUpdateCommand, APIRequst<int>>
    {
        public OrcanUpdateCommandHandler(IBaseRepository<OrcanClass> OrcanRepository)
        {
            this.OrcanRepository = OrcanRepository;
        }

        public IBaseRepository<OrcanClass> OrcanRepository { get; }

        public async Task<APIRequst<int>> Handle(OrcanUpdateCommand request, CancellationToken cancellationToken)
        {
            request.Data.UpdateTime=DateTime.Now;
            return new APIRequst<int>
            {
                Code = RequstCode.成功,
                Msg = "",
                Data = await OrcanRepository.Update(request.Data)
            };
        }
    }
}
